package auth

import "douhu_backend/internal/errors"

// Errno Controller层错误定义
type Errno struct {
	Code    int
	Message string
}

// Controller层错误码定义（引用 errors 包的错误码常量）
var (
	// 成功
	OK = &Errno{Code: errors.CodeSuccess, Message: "成功"}

	// 通用错误
	ErrSystemError = &Errno{Code: errors.CodeSystemError, Message: "系统错误"}

	// 参数错误
	ErrParams      = &Errno{Code: errors.CodeParamsInvalid, Message: "请求参数错误"}
	ErrPhoneFormat = &Errno{Code: errors.CodePhoneFormat, Message: "手机号格式不正确"}
	ErrCodeType    = &Errno{Code: errors.CodeTypeInvalid, Message: "验证码类型不正确"}
	ErrCodeInvalid = &Errno{Code: errors.CodeInvalid, Message: "验证码错误"}
	ErrCodeExpired = &Errno{Code: errors.CodeExpired, Message: "验证码不存在或已过期"}

	// 业务逻辑错误
	ErrSendTooFrequent    = &Errno{Code: errors.CodeSendTooFrequent, Message: "操作过于频繁，请稍后再试"}
	ErrDailyLimitExceeded = &Errno{Code: errors.CodeDailyLimitExceed, Message: "今日发送次数已达上限"}
	ErrSMSSendFailed      = &Errno{Code: errors.CodeSMSSendFailed, Message: "短信发送失败，请稍后重试"}
	ErrUserNotFound       = &Errno{Code: errors.CodeUserNotFound, Message: "用户不存在"}
	ErrUserDisabled       = &Errno{Code: errors.CodeUserDisabled, Message: "账户已被禁用"}
	ErrLoginLocked        = &Errno{Code: errors.CodeLoginLocked, Message: "账户已被锁定，请稍后再试"}
	ErrTokenInvalid       = &Errno{Code: errors.CodeTokenInvalid, Message: "Token无效"}
	ErrTokenExpired       = &Errno{Code: errors.CodeTokenExpired, Message: "Token已过期或被撤销"}
	ErrNoAuth             = &Errno{Code: errors.CodeTokenRevoked, Message: "用户未登录"}
	ErrCreateUserFailed   = &Errno{Code: errors.CodeCreateUserFailed, Message: "创建用户失败"}
	ErrUpdateUserFailed   = &Errno{Code: errors.CodeUpdateUserFailed, Message: "更新用户失败"}
	ErrSaveSMSCodeFailed  = &Errno{Code: errors.CodeSaveSMSCodeFailed, Message: "保存验证码失败"}
	ErrUserAlreadyExists  = &Errno{Code: errors.CodeUserAlreadyExists, Message: "该手机号已注册，请直接登录"}
)
